import pymongo

client = pymongo.MongoClient("localhost", 27017)
db = client['em']


# 基本数据
COL_BASE_DATA = 'base_data'

# 分钟序列表
COL_STK_MIN_HIS_DATA = 'stk_min_his_data'
# 停牌表
COL_NOT_TRADE_DATA = 'not_trade_data'
# 历史数据
COL_STK_HIS_DATA = 'stk_his_data'
# 指标历史记录
COL_INDEX_HIS_DATA = 'index_his_data'
# 机器人交易记录表
COL_AI_TRADE_HIS = 'ai_trade_his'
# 仓位记录
COL_POSITION_RECORD = 'position_record'
# 权息记录表
COL_PROFIT_DATA = 'profit_data'
# 自选
COL_SELF_FUND = 'self_fund'
# 实时热股
COL_REAL_TIME_HOT = 'self_real_time'
# 模块
COL_MODULE_DATA = 'module_data'
# 预设
COL_SELF_FUND_SET = 'self_fund_set'
# 历史数据

COL_ENV_FEEL_FACTOR = 'env_feel_factor'

COL_ENV_FEEL_REAL_TIME = 'env_feel_real_time'

COL_PARAM_TOP_30 = 'param_top_30'

# 真实的环境下操作的记录
COL_REAL_POSITION_RECORD = 'real_position_record'
# 真实的环境下买卖的单
COL_REAL_TRADE_HIS = 'real_trade_his'

db_collections_names = [COL_SELF_FUND_SET,
                        COL_MODULE_DATA,
                        COL_BASE_DATA,
                        COL_INDEX_HIS_DATA,
                        COL_STK_MIN_HIS_DATA,
                        COL_NOT_TRADE_DATA,
                        COL_STK_HIS_DATA,
                        COL_PROFIT_DATA,
                        COL_SELF_FUND,
                        COL_REAL_TIME_HOT,
                        COL_PARAM_TOP_30,
                        COL_ENV_FEEL_FACTOR,
                        COL_ENV_FEEL_REAL_TIME,
                        COL_REAL_POSITION_RECORD,
                        COL_REAL_TRADE_HIS]

exit_collections = db.collection_names()

for name in db_collections_names:
    if name not in exit_collections:
        db.create_collection(name=name)